public class Demo1 {
    public static void main(String[] args) {
        int count = 0;
        int num = 1;
        while (count < 2023) {
            if (method(num, 2) && method(num, 8) && method(num, 10) && method(num, 16)) {
                System.out.println(num);
                count++;
            }
            num++;
        }
    }

    public static boolean method(int num, int system) {
        int x = num;
        int sum = 0;
        while (x > 0) {
            sum += x % system;
            x /= system;
        }
        return num % sum == 0;
    }
}
